package com.lcxw.hxzb.friendcircle.project.system.controller;

import com.lcxw.hxzb.friendcircle.framework.web.controller.BaseController;
import com.lcxw.hxzb.friendcircle.framework.web.domain.AjaxResult;
import com.lcxw.hxzb.friendcircle.framework.web.page.TableDataInfo;
import com.lcxw.hxzb.friendcircle.project.system.domain.YwpdOrderLabel;
import com.lcxw.hxzb.friendcircle.project.system.service.IYwpdOrderLabelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * 订单和评价关联Controller
 * 
 * @author ruoyi
 * @date 2020-09-16
 */
@RestController
@RequestMapping("/system/label")
public class YwpdOrderLabelController extends BaseController
{
    @Autowired
    private IYwpdOrderLabelService ywpdOrderLabelService;

    /**
     * 查询订单和评价关联列表
     */
    @GetMapping("/list")
    public TableDataInfo list(YwpdOrderLabel ywpdOrderLabel)
    {
        startPage();
        List<YwpdOrderLabel> list = ywpdOrderLabelService.selectYwpdOrderLabelList(ywpdOrderLabel);
        return getDataTable(list);
    }

    /**
     * 获取订单和评价关联详细信息
     */
    @GetMapping(value = "/{labelId}")
    public AjaxResult getInfo(@PathVariable("labelId") Long labelId)
    {
        return AjaxResult.success(ywpdOrderLabelService.selectYwpdOrderLabelById(labelId));
    }

    /**
     * 新增订单和评价关联
     */
    @PostMapping
    public AjaxResult add(@RequestBody YwpdOrderLabel ywpdOrderLabel)
    {
        return toAjax(ywpdOrderLabelService.insertYwpdOrderLabel(ywpdOrderLabel));
    }

    /**
     * 修改订单和评价关联
     */

    @PutMapping
    public AjaxResult edit(@RequestBody YwpdOrderLabel ywpdOrderLabel)
    {
        return toAjax(ywpdOrderLabelService.updateYwpdOrderLabel(ywpdOrderLabel));
    }

    /**
     * 删除订单和评价关联
     */

	@DeleteMapping("/{labelIds}")
    public AjaxResult remove(@PathVariable Long[] labelIds)
    {
        return toAjax(ywpdOrderLabelService.deleteYwpdOrderLabelByIds(labelIds));
    }
}
